import request from "../request";

// 获取分类视频列表
const getVideoList = (params: any) => {
  return request({
    url: "/website/video/list",
    method: "get",
    params,
    paramsSerializer: function (params) {
      let result = [];
      for (let field in params) {
        if (params[field] === undefined || params[field] === null) {
          result.push(`${field}=`);
          continue;
        }
        if (Array.isArray(params[field])) {
          result.push(params[field].map((_) => `${field}=${_}`).join("&"));
        } else {
          result.push(`${field}=${encodeURIComponent(params[field])}`);
        }
      }
      return result.join("&");
    },
  });
};
// 获取标签列表
const getTabList = (query: any) => {
  return request({
    url: "/website/tag/list",
    method: "get",
    params: query,
  });
};

export { getVideoList, getTabList };
